<template>
  <div v-html="contentReplace(message)">
  </div>
</template>

<script setup lang="ts">
import {faceUtils} from "@/components/Monitor/components/util";
 defineProps({
      message: {
        type: String,
        default: ''
      }
    }
)
const contentReplace = (content: string): string => {
  const fa = faceUtils.faces() as any;
  content = content
      // 转义表情
      .replace(/\[([^\s[\]]+?)]/g, function (face) {
        const alt = face.replace(/^/g, '')
        return '<img class="emoji" style="width:24px;height:24px;"  src="' + fa[alt] + '"/>'
      })
  return content
}
</script>

<style lang="scss" scoped>

</style>